

from commonServiceApi.CommonLoginApi import ALoginApi
from utils import HttpUtils


class TTZLoginImpl(ALoginApi):
    def login(self, BLogin):
        # 'http://webapicname.coo456.com/apiNew/H5login?token=3433a441ac7e0ea5f019f99f8e1600ad&client=app&Cellphone=17120572203&Password=qm1006406&Imei=unknow/',
        try:
            loginUrl = BLogin.burl.LOGIN_URL+f"?client=app&Cellphone={BLogin.userPhone}&Password={BLogin.userPassword}"
            loginData = HttpUtils.get(BLogin.bInfo+"用户登录", loginUrl)
            token = loginData["Data"]["Token"]
            if len(token) !=0 :
                BLogin.userToken = token
                return BLogin
            else:
                BLogin.userToken = ""
                return BLogin
        except:
            return None


    def logout(self, userToken):
        pass